package com.luchao.back.controller;

import com.luchao.back.common.pojo.ResponseResult;
import com.luchao.back.service.ReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "统计报表")
@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    @ApiOperation("生成流量报表")
    @ApiResponses(value = @ApiResponse(description = "code:响应状态码,message:返回操作消息,data:操作携带的具体数据信息"))
    @PostMapping("/getFlow")
    public ResponseResult getFlow() {
        return ResponseResult.success(reportService.getFlow());
    }

    @ApiOperation("生成营销报表")
    @ApiResponses(value = @ApiResponse(description = "code:响应状态码,message:返回操作消息,data:操作携带的具体数据信息"))
    @PostMapping("/getMarketing")
    public ResponseResult getMarketing() {
        return ResponseResult.success(reportService.getMarketing());
    }

    @ApiOperation("生成业绩报表")
    @ApiResponses(value = @ApiResponse(description = "code:响应状态码,message:返回操作消息,data:操作携带的具体数据信息"))
    @PostMapping("/getPerformance")
    public ResponseResult getPerformance() {
        return ResponseResult.success(reportService.getPerformance());
    }
}
